package xmongo

import (
	"context"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
)

// Client
type Client struct {
	*mongo.Client
	Config *Config
}

type Database struct {
	*mongo.Database
}

func NewClient(opt *Config) *Client {
	client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(opt.Url))
	if err != nil {
		panic(err)
	}

	dbClient := &Client{
		client,
		opt,
	}

	return dbClient
}
